<template>
  <div class="top">
    <van-icon @click="goBack" class="icon" name="arrow-left" />
    <div class="title">{{title}}</div>
    <slot>
      <div @click="go"><span class="iconfont icon-31shouye"></span></div>
    </slot>
    
  </div>
</template>

<script>
export default {
  props:['title'],
  methods: {
    goBack() {
        // 清空背景颜色
      document.querySelector("body").removeAttribute("style");
    //  this.$router.go(-1)
      window.history.go(-1);
    },
    go() {
        // 清空背景颜色
      document.querySelector("body").removeAttribute("style");
      
      this.$router.push({ path: "/" });
    },
  },
};
</script>

<style scoped lang='scss'>
.top {
  height: 1.0732rem;
  background-color: #b0352f;
  display: flex;
  color: white;
  font-size: 6vw;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  width: 100vw;
  padding: 0 2vw;
  .icon-31shouye{
      font-size: 5vw;
  }

  .title {
    font-size: 0.3902rem;
  }
}
</style>